package com.jiyun.utils;

import lombok.Data;
import lombok.ToString;

import java.io.Serializable;

@Data
@ToString
public class R<T> implements Serializable {

    //1成功
    //2失败
    private Integer code;

    private String message;

    private T data;


    public static R ok(Object data){
        R<Object> r = new R<>();
        r.setCode(1);
        r.setMessage("操作成功");
        r.setData(data);
        return r;
    }
    public static R error(){
        R<Object> r = new R<>();
        r.setCode(2);
        r.setMessage("操作失败！！！");
        return r;
    }
}